<?php

// $Id$

require_once($WSC->get_site_inc_dir().'modules/web_site_chocolate/chocolate_web_page.class.php');
require_once('tcms_web_page_view.class.php');
require_once($WSC->get_site_inc_dir().'modules/smarty_resource_db/smarty_resource_db_init.inc.php');


class TCMS_Web_Page extends Chocolate_Web_Page {
	public function init() {
		parent::init();

		$dbc = $this->get_dbc();

		smarty_resource_db_init($dbc);
	}

	public function create_view($name = 'default') {
		$dbc = $this->get_dbc();

		$settings_visuals = new TCMS_Settings_Visuals_DBC();
		if ($settings_visuals->load_by_id($dbc, 1)) {
			$this->export('settings_visuals', $settings_visuals);
		} else {
			throw new Tangra_Module_Exception('Cannot load settings visuals');
		}


		$ret = new TCMS_Web_Page_View($this, $name, $settings_visuals->get_html_resource_path().'pages/');

		return $ret;
	}
}